<?
if($_POST)
{
	mysql_query("DELETE FROM `menu` WHERE `menu`.`md_id` = '".$_REQUEST['md_id']."' LIMIT 1");
	
	
	$maxorder = Q1("select MAX(menu_order) from menu  ");
	
	$valuearray['menu_text'] = $_POST['menu_text'];
	$valuearray['menu_text2'] = $_POST['menu_text2'];
	$valuearray['md_id'] = $_POST['md_id'];
	$valuearray['menu_order'] = $maxorder[0]+1;
	$valuearray['menu_ip'] = $_SERVER['REMOTE_ADDR'];
	Qinsert("menu","",$valuearray);
	
	
}
?>

<?
$r = Q1("select * from menu where md_id = '".$_REQUEST['md_id']."' ");
$finc = Q1(" select md_function from module where md_id = '".$_REQUEST['md_id']."' ");
if(strstr($finc['md_function'],"timce|"))
{
?>

<!-- TinyMCE -->
<script type="text/javascript" src="js/ckeditor/ckeditor.js"></script>

<!-- /TinyMCE -->
<?
}
$rx = Q1("select * from language limit 1");
?>


<p>
    <form action="" method="post" name="fm1">
	<?=$rx[lang1]?> <br/>
      <textarea name="menu_text" style="width:100%;height:500px;" ><?=$r['menu_text']?></textarea>
	<?=$rx[lang2]?> <br/>
      <textarea name="menu_text2" style="width:100%;height:500px;" ><?=$r['menu_text2']?></textarea>
      <br />
<br />

    <input name="submit" type="submit" value="<?=btsubmit($r['md_id'])?>" />
    <input name="md_id" type="hidden" value="<?=$_REQUEST['md_id']?>" />
    </form>
</p>
<script>

var path = "/admin/js";	
CKEDITOR.replace( 'menu_text' ,{
	
	filebrowserBrowseUrl : path+'/ckfinder/ckfinder.html',
    filebrowserImageBrowseUrl : path+'/ckfinder/ckfinder.html?Type=Images',
    filebrowserFlashBrowseUrl : path+'/ckfinder/ckfinder.html?Type=Flash',
    filebrowserUploadUrl : path+'/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
    filebrowserImageUploadUrl :path+ '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
    filebrowserFlashUploadUrl : path+'/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
	
	
	
	
	});</script>
<script>CKEDITOR.replace( 'menu_text2' ,{
	
	filebrowserBrowseUrl : path+'/ckfinder/ckfinder.html',
    filebrowserImageBrowseUrl : path+'/ckfinder/ckfinder.html?Type=Images',
    filebrowserFlashBrowseUrl :path+ '/ckfinder/ckfinder.html?Type=Flash',
    filebrowserUploadUrl : path+'/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
    filebrowserImageUploadUrl :path+ '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
    filebrowserFlashUploadUrl :path+'/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
	
	
	
	
	});


</script>